#ifndef SELECTION_LIST_MODEL_H
#define SELECTION_LIST_MODEL_H

#include <QAbstractListModel>
#include <QPair>
#include <QString>
#include <QVector>


struct Selection{
    QString name;
    QVariant value;
};
Q_DECLARE_METATYPE(Selection);

using  SelectionPair =  QVector<Selection>;
class SelectionListModel : public QAbstractListModel
{
    Q_OBJECT

public:
    explicit SelectionListModel( const SelectionPair& selections , QObject *parent = nullptr);

    // Header:
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;

    // Basic functionality:
    int rowCount(const QModelIndex &parent = QModelIndex()) const override;

    // Fetch data dynamically:
    bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;

    bool canFetchMore(const QModelIndex &parent) const override;
    void fetchMore(const QModelIndex &parent) override;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;

private:
    SelectionPair selections_;
};

#endif // SELECTION_LIST_MODEL_H
